﻿using BuzzX8.Xmpp.StreamElements.Stanza;

namespace BuzzX8.Xmpp.StreamElements.Factories
{
    public abstract class StanzaModel<T> : DatagramElementModel
    {
        private StanzaErrorElementInfo errorElementInfo;

        protected StanzaModel(PropertyDictionary parameters) : base(parameters)
        {
            errorElementInfo = new StanzaErrorElementInfo();
        }

        public T Type
        {
            get { return ModelParameters.Get<T>("type"); }
            set { ModelParameters["type"] = value; }
        }

        public override ErrorElementInfo ErrorElementInfo
        {
            get { return errorElementInfo; }
        }

        public StanzaErrorElementInfo StanzaErrorElementInfo
        {
            get { return errorElementInfo; }
        }
    }

    public class StanzaErrorElementInfo : ErrorElementInfo
    {
        public StanzaErrorType ErrorType { get; set; }
    }
}
